﻿@model PagedList.IPagedList<CultuRAM.Models.EventParticipant>



@if (Model != null && Model.Count() != 0){
 
    <table id="tablePar" class="table table-hover table-striped table-bordered" style="width:100%;">
        <tr>
            <th style="width: 40%;">
                @Html.DisplayNameFor(model => model.FirstOrDefault().Participant.Name)
            </th>
            <th style="width: 60%;">
                @Html.DisplayNameFor(model => model.FirstOrDefault().Obs)
            </th>
        </tr>
        @foreach (var item in Model)
        {
            <tr id="@item.EventParticipantId">
                <td>
                    @Html.DisplayFor(modelItem => item.Participant.Name)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Obs)
                </td>
            </tr>
        }
    </table>
    
    <div class="row-fluid pagination-botton"> 
        <div class="span6">      
           
            @Html.Raw(@Ajax.ActionLink("replacetxt", "CreatePv", "EventParticipant",new { page = Model.PageNumber, idEvent = Model.FirstOrDefault().Event.EventId},
                             new AjaxOptions
                                 {
                                     UpdateTargetId="tabEventParRight", 
                                     InsertionMode = InsertionMode.Replace, 
                                     HttpMethod = "GET", 
                                     OnComplete = "ParBgColorAdd()"
                                 }, new { @class = "btn btn-success btn-xs", id="btnAddPar" }) 
		            .ToHtmlString().Replace("replacetxt", "<i class=\"icon-plus icon-white\"></i> Adicionar"))

	       @Html.Raw(@Ajax.ActionLink("replacetxt", "EditPv", "EventParticipant", new { page = Model.PageNumber},
                             new AjaxOptions
                                 {
                                     UpdateTargetId="tabEventParRight", 
                                     InsertionMode = InsertionMode.Replace, 
                                     HttpMethod = "GET",
                                     OnComplete = "ParBgColorEdit()" 
                                 }, new { @class = "btn btn-warning btn-xs", id="btnEditPar" }) 
		            .ToHtmlString().Replace("replacetxt", "<i class=\"icon-pencil icon-white\"></i> Editar"))
            
            @Html.Raw(@Ajax.ActionLink("replacetxt", "DeletePv", "EventParticipant", new { page = Model.PageNumber},
                        new AjaxOptions
                            {
                                UpdateTargetId = "tabEventParRight",
                                InsertionMode = InsertionMode.Replace,
                                HttpMethod = "GET",
                                OnComplete = "ParBgColorDel()"
                            }, new { @class = "btn btn-danger btn-xs", id = "btnDelPar" }) 
                    .ToHtmlString().Replace("replacetxt", "<i class=\"icon-remove icon-white\"></i> Eliminar"))
        </div> 
        
        <div class="span6">
            <div class="pagination" style="margin: 0">
                <ul>
                    @if (Model.HasPreviousPage)
                    {
                        <li>
                            @Ajax.ActionLink("«", "IndexPv", "EventParticipant", new { page = 1, idEvent = Model.FirstOrDefault().Event.EventId},
                                             new AjaxOptions
                                                 {
                                                     UpdateTargetId="tabEventParLeft", 
                                                     InsertionMode = InsertionMode.Replace, 
                                                     HttpMethod = "GET" 
                                                 }, new { @class = ""}) 
                        </li> 
                        <li>
                            @Ajax.ActionLink("<", "IndexPv", "EventParticipant", new { page = Model.PageNumber - 1, idEvent = Model.FirstOrDefault().Event.EventId},
                                             new AjaxOptions
                                                 {
                                                     UpdateTargetId="tabEventParLeft", 
                                                     InsertionMode = InsertionMode.Replace, 
                                                     HttpMethod = "GET" 
                                                 }, new { @class = ""}) 
                        </li>
                        <li class="">
                            <a href="#" data-original-title="" title="" class="">
                                Página <b> @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber)</b> de <b> @Model.PageCount </b>
                            </a>
                        </li>  
                    }
                    else
                    {
                        <li class="disabled"><a href="#" data-original-title="" title="" class="">«</a></li> 
                        <li class="disabled"><a href="#" data-original-title="" title="" class=""><</a></li> 
                        <li class="">
                            <a href="#" data-original-title="" title="" class="disabled">
                                Página <b> @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber)</b> de <b> @Model.PageCount </b>
                            </a>
                        </li> 
                    }
                    <li>
                    @if (Model.HasNextPage)
                    {
                        <li>
                            @Ajax.ActionLink(">", "IndexPv", "EventParticipant", new { page = Model.PageNumber + 1, idEvent = Model.FirstOrDefault().Event.EventId},
                                             new AjaxOptions
                                                 {
                                                     UpdateTargetId="tabEventParLeft", 
                                                     InsertionMode = InsertionMode.Replace, 
                                                     HttpMethod = "GET" 
                                                 }, new { @class = ""}) 
                        </li>
                        <li>
                            @Ajax.ActionLink("»", "IndexPv", "EventParticipant", new { page = Model.PageCount, idEvent = Model.FirstOrDefault().Event.EventId},
                                             new AjaxOptions
                                                 {
                                                     UpdateTargetId="tabEventParLeft", 
                                                     InsertionMode = InsertionMode.Replace, 
                                                     HttpMethod = "GET" 
                                                 }, new { @class = ""}) 
                        </li>
                    }
                    else
                    {
                        <li class="disabled"><a href="#" data-original-title="" title="" class="disabled">></a></li> 
                        <li class="disabled"><a href="#" data-original-title="" title="" class="disabled">»</a></li>
                    }
                </ul>
            </div>  
        </div>
    </div>

}else{
    
    <div id="msgInf_" class="alert alert-warning" style="margin-top: 10px;">Este evento não tem Artístas definidos!</div>
    <br/>
    <p> @Html.Raw(@Ajax.ActionLink("replacetxt", "CreatePv", "EventParticipant",new {idEvent = ViewBag.idEv},
                        new AjaxOptions
                            {
                                UpdateTargetId="tabEventParRight", 
                                InsertionMode = InsertionMode.Replace, 
                                HttpMethod = "GET", 
                                OnComplete = "ParBgColorAdd()"
                            }, new { @class = "btn btn-success btn-xs", id="btnAddPar" }) 
            .ToHtmlString().Replace("replacetxt", "<i class=\"icon-plus icon-white\"></i> Adicionar"))
    </p>
      
    
}



@Scripts.Render("~/bundles/culturam")